#include <iostream>
#include <cmath>
#include <vector>
#include <iomanip>

using namespace std;

class MyVector {
public:
    int x, y, z;
    float myLength;

    MyVector(int x, int y, int z) : x(x), y(y), z(z) {
        myLength = 0;
    }

    void calculateLength() {
        myLength = sqrt(x * x + y * y + z * z);
    }

    double outputLength() {
        return myLength;
    }
};

int main(int argc, char const *argv[]) {
    vector<MyVector> v;
    int x1, y1, z1, x2, y2, z2;

    int count; // 次数
    cin >> count;
    for (int i = 0; i < count; i++) {
        cin >> x1 >> y1 >> z1 >> x2 >> y2 >> z2;
        v.emplace_back(x1 + x2, y1 + y2, z1 + z2);
        v.emplace_back(x1 - x2, y1 - y2, z1 - z2);
    }

    for (int i = 0; i < count * 2; i++) {
        v[i].calculateLength();
        // 这里，指定小数点后位数的
        cout << fixed << setprecision(2) << v[i].outputLength();
        if (i % 2 == 0)
            cout << " ";
        else if (i % 2 == 1)
            cout << "\n";
    }

    return 0;
}
